from typing import List, Optional
from pydantic import BaseModel, Field
import time


class BookshelfInsert(BaseModel):
    user_id: int = Field(..., description="用户ID")
    book_id: int = Field(..., description="图书ID")
    add_at: int = Field(
        default_factory=lambda: int(time.time()), description="加入时间戳"
    )
    """加入时间戳，默认当前时间"""


class BookshelfRemove(BaseModel):
    user_id: int = Field(..., description="用户ID")
    book_id: int = Field(..., description="图书ID")
    """从书架移除图书时需要的字段"""


class BookshelfAddRequest(BaseModel):
    """添加图书到书架的请求模型"""

    book_id: int = Field(..., description="图书ID，必填")
